﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


// Condition: Write a program that finds all prime numbers in the range[1...10 000 000]
//            Use the sieve of Eratosthenes algorithm.

class PrimeNumbers
{
    static void Main()
    {
        long n = 10000000;

        bool[] eratost = new bool[n];

        for (long i = 2; i < n; i++)
        {
            eratost[i] = true;
        }

        for (long j = 2; j < n; j++)
        {
            if (eratost[j])
            {
                for (long p = 2; p < n / j; p++)
                {
                    eratost[j * p] = false;
                }
            }
        }
        for (long i = 0; i < n; i++)
        {
            if (eratost[i] == true)
            {
                Console.Write(i + " ");
            }
        }
        Console.WriteLine();
    }
}

